package com.novax.ex.activity.provider.service;

import com.novax.ex.activity.infrastructure.entity.OperationConfig;
import com.novax.ex.activity.infrastructure.entity.OperationUserLog;
import com.novax.ex.activity.infrastructure.mapper.OperationConfigMapper;
import com.novax.ex.activity.infrastructure.mapper.OperationContentMapper;
import com.novax.ex.activity.infrastructure.mapper.OperationUserLogMapper;
import com.novax.ex.activity.open.model.query.OperationUserLogQuery;
import com.novax.ex.activity.open.model.request.OperationUserLogRequest;
import com.novax.ex.activity.open.model.response.OperationUserLogResponse;
import com.novax.ex.activity.provider.controller.BaseActivityController;
import com.novax.ex.common.base.BaseEntity;
import com.novax.ex.common.base.BaseMapper;
import com.novax.ex.common.base.BaseService;
import com.novax.ex.common.util.PageUtil;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * @Description 活动参与日志
 * @Author ChenXi
 * @Date 2023/04/18/10:08
 */

@Service
public class OperationUserLogService extends BaseService {

    @Resource
    private OperationUserLogMapper operationUserLogMapper;

    @Resource
    private OperationConfigMapper operationConfigMapper;

    @Override
    protected BaseMapper getBaseMapper() {
        return operationUserLogMapper;
    }

    /**
     * @Description: 查询用户是否参与过次活动
     * @Author: ChenXi
     * @Date:  2023/4/18 14:47
     * @param userId
     * @param customId
     * @return: java.lang.Integer
     **/
    public Integer selectUserIdAndCustomId(Long userId, String customId) {
         return operationUserLogMapper.selectUserIdAndCustomId(userId, customId);
    }

    /**
     * @Description: 查询所有用户参与日志
     * @Author: ChenXi
     * @Date:  2023/4/19 14:53
     * @param pageInfo
     * @return: java.util.List<com.novax.ex.common.base.BaseEntity>
     **/
    public List<OperationUserLog> queryList(PageUtil<OperationUserLogResponse> pageInfo) {
        return operationUserLogMapper.selectPage(pageInfo);
    }

    /**
     * @Description: 根据自定义id获得operationId
     * @Author: ChenXi
     * @Date:  2023/4/20 11:04
     * @param customId
     * @return: void
     **/
    public OperationConfig queryOperationIdByCustomId(String customId) {
        return operationConfigMapper.queryOperationIdByCustomId(customId);
    }


}
